//Francisco "Kiko" Olvera
//Handles all game logic
//contains one board and four players
//holds game sound
//Game.h

#pragma once
#include "Board.h"
#include "Player.h"
#include "SpriteInfo.h"
#include "Definitions.h"
#include "Mesh.h"
#include "Card.h"
#include "Artifact.h"
#include "Text.h"
#include "sound.h"
#include "Button.h"
#include "Globals.h"

class Sprite;
class Input;
class PowerUp;
class Controller;

class Game
{
private:
	Controller*			controller;
	PowerUp*			power;
	Board				board;
	Player				player[NUM_PLAYERS];
	int					PlayerTurn, numPlayers, *playerOrder;
	PLAYER_TURN_STATES	turn;
	PLAYER_TURN_STATES  previousState;
	Input*				input;
	Sprite*				sprite;
	SpriteInfo			texture[NUM_GAME_SPRITES];
	SpriteInfo			pauseTexture[NUM_PAUSE_SPRITES];
	SpriteInfo*			cardInfo;
	Button				pauseButton[NUM_PAUSE_BUTTONS];
	Button				selectedButton;						//Button object that represents a selected menu button (the mouse is over it)
	Text				gameText;
#ifdef USING_SOUND
	sound Sound;
	bool soundToPlay[NUM_GAME_SOUNDS];
#endif

private:
	//artifacts
	Mesh art;
	Artifact artifact[NUM_ARTIFACTS];
	Card card[NUM_ARTIFACTS];
private:
	int		numCards;
	Card**	player1Cards;
	Card**	player2Cards;
	Card**	player3Cards;
	Card**	player4Cards;
	bool	picked[NUM_ARTIFACTS];
private:
	void initSounds();
	int pickCard();
	void initPlayers();
	void dealCards();
	void initArtifactsAndCards();
	void initPauseScreen();
	void nextPlayer();
	void controlMusic();
	void RenderPauseScreen();
	void highlightArtifacts();
public:
	Game();
	void Init(Sprite*, Input*, int, int*);
	CONTROLLER_STATE Update();
	void CameraMove();
	void Render();
	void Release();
public:
	//gets
	Board* getBoard()		{return &board;}
	Player* getPlayers()	{return player;}
};